package com.redisdemo.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.redisdemo.domain.CmsTask;
import com.redisdemo.service.CmsTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <h3>redisDemo</h3>
 * <p>任务表控制器</p>
 *
 * @author gdw
 * @since 2024-06-28 14:43:01
 */
@RestController
@RequestMapping("/task")
public class CmsTaskController {
    @Autowired
    private CmsTaskService cmsTaskService;

    /**
     * 分页查询,测试springcache
     */
    @Cacheable(value = "demo:pages", key = "#params['index'] + '-' + #params['fo']")
    @GetMapping("/page")
    public Page<CmsTask> selectPage(@RequestParam Map<String, Object> params) {
        return cmsTaskService.selectPage(params);
    }
}
